﻿using System;

namespace NKG_MVVM_UI
{
    class Program
    {
        static void Main(string[] args)
        {
            // 创建Model
            Test01Model test01Model = new Test01Model();

            // 创建UI对应的UI数据ViewModel
            Test01AViewModel test01AViewModel = VMManager.Instance.CreateVM<Test01AViewModel>();
            
            // 显示一个UI(View)
            Test01View test01View = UIManager.Instance.OpenUI<Test01View>();
            
            // 绑定V和VM
            test01View.BindingContext = test01AViewModel;
            
            // 进行VM数据初始化，绑定M和VM
            test01Model.Init(test01AViewModel);
            
            test01Model.ChangeModelContent();
            test01View.ChangeTextContent();

            //打印目标的所有State历史
            StateManager.Instance.LogTargetState<Test01State>();

            //关闭UI，释放数据
            UIManager.Instance.CloseUI(test01View);
            VMManager.Instance.ReleaseVM(test01AViewModel);
        }
    }
}